home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: How do I modify a character string that's declared as an array of char?
- Date: 02 Mar 1996 18:56:40 GMT
- Organization: Los Alamos National Laboratory
- Distribution: world
- Message-ID: <TANMOY.96Mar2115640@qcd.lanl.gov>
- References: <4gj2nl$840@mirzam.usc.edu> <4gqo63$2pr@newshost.cyberramp.net>
- <TANMOY.96Feb25203754@qcd.lanl.gov> <4h75t1$q7s@newshost.cyberramp.net>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: sinan@cyberramp.net's message of 1 Mar 1996 15:42:25 GMT
-
- In article <4h75t1$q7s@newshost.cyberramp.net>
- sinan@cyberramp.net (John Noland) writes:
-
- <snip>
- JN: ANSI treats &mydata as a pointer to the entire array. Some
- compilers treat
- JN: &mydata as a pointer to the first element. Some compilers disallow
- &mydata
- JN: constructs altogether. Hence, this is not a portable construct.:-)
- Use it if
- JN: you like, me, I'll pretend it's not legal. Preferring instead:
- JN:
- JN: char (*p)(50);
- JN:
- JN: p = (char (*)[50]) mydata;
- JN:
-
- The mindset that ANSI is not portable is soon becoming outdated: Most
- people I know of have access to at least almost ANSI compilers.
-
- According to ANSI, the meaning of (char(*)[50])mydata depends on the
- implementation. &mydata is defined by the standard.
-
- JN:
- JN: Just my opinion. Your code doesn't have to be portable.
- JN:
-
- I believe that strict ANSI code is completely portable today.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-